package com.suineg.pms.entity.base;

import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.collect.Lists;
import com.suineg.pms.entity.IdEntity;
import com.suineg.pms.entity.User;

/**
 * 物业公司 
 *@author Suine
 */
@Entity
@Table(name = "pms_company")
public class Company extends IdEntity{
	/** 日志输出对象 */
	protected final Logger logger = LoggerFactory.getLogger(getClass());
	/** 物业公司 名 */
	private String name;
	/** 地址 */
	private String address;
	/** 电话 */
	private String tel;
	/** 物业公司编号  */
	private String no;
	/** 操作人 */
	private User opuser;
	/** 操作时间 */
	private Date opdate;
	/** 小区 */
	private List<Community> communityList = Lists.newArrayList();
	
	@OneToMany(fetch = FetchType.LAZY,mappedBy = "company")
	@OrderBy("name")
	public List<Community> getCommunityList() {
		return communityList;
	}
	public void setCommunityList(List<Community> communityList) {
		this.communityList = communityList;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getTel() {
		return tel;
	}
	public void setTel(String tel) {
		this.tel = tel;
	}
	public String getNo() {
		return no;
	}
	public void setNo(String no) {
		this.no = no;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	public User getOpuser() {
		return opuser;
	}
	public void setOpuser(User opuser) {
		this.opuser = opuser;
	}
	public Date getOpdate() {
		return opdate;
	}
	public void setOpdate(Date opdate) {
		this.opdate = opdate;
	}
}

